package JDBC;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

//修改数据库数据
public class Test4 {
    public static void main(String[] args) throws SQLException {
        User user = new User();
        user.setUserId("108");
        user.setName("杨敏");
        user.setEname("dog");
        user.setPersonId("");
        user.setSex("男");
        user.setCredit(100);
        user.setCity("天京");
        Connection connectMysql = ConnectMysql.getConnectMysql();
        String sql= "  update user  set name= '"+user.getName()+"' where user.userId= '"+user.getUserId()+"' ";
        Statement statement = connectMysql.createStatement();
        int i = statement.executeUpdate(sql);
        System.out.println(i+"行受影响");
        statement.close();
        connectMysql.close();
    }
}